package ext.tianma.part.processors;

import java.util.List;

import wt.part.WTPart;
import wt.util.WTException;

import com.ptc.core.components.forms.DefaultObjectFormProcessor;
import com.ptc.core.components.forms.FormProcessingStatus;
import com.ptc.core.components.forms.FormResult;
import com.ptc.core.components.util.FeedbackMessage;
import com.ptc.core.ui.resources.FeedbackType;
import com.ptc.netmarkets.model.NmOid;
import com.ptc.netmarkets.util.beans.NmCommandBean;

import ext.tianma.workflow.SubmitBomReview;

public class SubmitBomReviewProcessor extends DefaultObjectFormProcessor {

	@Override
	public FormResult doOperation(NmCommandBean nmCommandBean, List list) throws WTException {
		
		FormResult formresult = new FormResult(FormProcessingStatus.SUCCESS);
		
		NmOid nmoid = nmCommandBean.getActionOid();
		WTPart currentPart = (WTPart) nmoid.getRefObject();
		
		if( currentPart != null ){
			SubmitBomReview.submitBOMReviewWorkflow( currentPart );
		}
		
		FeedbackMessage feedbackmessage = new FeedbackMessage(
				FeedbackType.SUCCESS, null, "天马BOM审核流程启动成功", null, new String[] {});
		formresult.addFeedbackMessage(feedbackmessage);
		return formresult;
	}

}
